package org.hackystat.devcathlon.ui.page.matches.manage.matchconfigurationpanel;

import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.hackystat.devcathlon.engine.match.Match;
import org.hackystat.devcathlon.ui.DevcathlonSession;
import org.hackystat.devcathlon.ui.page.DevcathlonBasePage;
import org.hackystat.devcathlon.ui.page.matches.manage.matchpanel.MatchPanel;

/**
 * The match configuration page uses the MatchPanel and MatchConfigurationPanel.  This page is 
 * called when the user clicks on to see configuration details.
 *  
 * @author robin
 *
 */
public class MatchConfigurationPage extends DevcathlonBasePage {
  /** Support serialization. */
  private static final long serialVersionUID = 1L;
  
  /**
   * The constructor.
   * @param mItem The match item.
   * @throws Exception If there are any errors with Tstamp.
   */
  public MatchConfigurationPage(Match mItem) throws Exception {
    // Set the body class attribute to section-3 so that the menubar is correct.
    add(new WebMarkupContainer("body") { 
      private static final long serialVersionUID = 1L;
      @Override
      public boolean isTransparentResolver() { 
        return true; 
        } 
      @Override
      protected void onComponentTag(ComponentTag tag) { 
        tag.put("class","thrColElsHdr section-3"); 
        }
    }
    ); 
    
    // Add matches panel.
    add(new MatchPanel("matchpanel", DevcathlonSession.get().getMatchesSession()
        .getMatchNames()));
    add(new MatchConfigurationPanel("matchconfigurationpanel", mItem));
    
    // Make the tab corresponding to this page bold.
    get("MatchesManageLink").add(new SimpleAttributeModifier("class", "selected"));
  }
}
